from sqlmodel import SQLModel, Field, Column, Integer, String, DateTime, func
import typing as T
from datetime import datetime


class UserKnowledgeBase(SQLModel, table=True):
    """
    用于记录用户知识库的相关信息的表
    """

    __tablename__ = "user_knowledgebase"
    id: int = Field(default=None, primary_key=True)
    userId: int = Field(
        sa_column=Column("user_id", Integer, nullable=False), description="用户id"
    )
    alias: str = Field(
        sa_column=Column("alias", String(128), nullable=False),
        description="用户知识库的别名",
    )
    createTime: datetime = Field(
        sa_column=Column(
            "create_time", DateTime, nullable=False, server_default=func.now()
        ),
        description="用户知识库的创建时间",
    )
